package com.woniuxy.microaftersaleserver.customservicemag.mapper;

import com.github.pagehelper.PageInfo;
import com.woniuxy.microcommonserver.bean.aftersales_cyx.CustomService;
import com.woniuxy.microcommonserver.pageHelper.PageRequest;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface CustomMapper {


    /**
     * 添加客服
     * @param customService
     */
    @Insert("insert into custom_service " +
            "(name,gmt_create,age,gender,telephone,gmt_modified,is_deleted)" +
            " values (#{c.name},#{c.gmtCreate},#{c.age},#{c.gender},#{c.telephone},#{c.gmtModified},0)")
    void addCustomerService(@Param("c") CustomService customService);

    /**
     * 修改客服信息
     * @param customService
     */
    void updateCustomService(@Param("c") CustomService customService);

    /**
     * 删除客服信息
     * @param id
     */
    @Update("update custom_service set is_deleted=1 where id=#{id}")
    void deleteCustomService(int id);

    /**
     * 分页查询客服人员
     * @param pageRequest
     * @param customService
     * @return
     */
    List<CustomService> findByPage(@Param("p") PageRequest pageRequest,@Param("c") CustomService customService);

    /**
     * 通过字段查找数据详情
     * @param customService
     * @return
     */
    List<CustomService> findByParams(CustomService customService);
}

